﻿#ifndef FILEWRITEUTIL_H
#define FILEWRITEUTIL_H

#include <map>
#include <string>
#include <fstream>
using namespace std;

class FileWriteUtil
{
public:
	FileWriteUtil(void);
	~FileWriteUtil(void);
    static FileWriteUtil* getInstance()
    {
        if(m_instance == NULL)
        {
            m_instance = new FileWriteUtil;
        }
        return m_instance;
    }
    static void delInstance()
    {
        if (m_instance)
        {
            delete m_instance;
            m_instance = NULL;
        }
    }
 private:
	fstream *m_mStream;
    std::string m_FileName;
    std::string m_FilePath;
    double m_iFileSize;
    double m_iWirteFileOffet;
    bool m_bFileOpenFlag;
    static FileWriteUtil* m_instance;

public:
	bool OpenFile();
	void CloseFile(void);
	void WriteBufferData(char * pbuf,int iLen);
    int SetFilePath(std::string strFilePath);
    int SetFileName(std::string strFileName);
    void SetFileSize(double iSize);
    double GetFileOffset();
};

#endif
